home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9463 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: fsgi01.fnal.gov!not-for-mail
  2. From: b91926@fsgi01.fnal.gov (David Sachs)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: dynamic_cast costs?
  5. Date: 1 Mar 1996 15:23:03 -0600
  6. Organization: FERMILAB, Batavia, IL
  7. Message-ID: <4h7prn$666@fsgi01.fnal.gov>
  8. References: <4h79hl$7lc@news.halcyon.com>
  9. Reply-To: sachs@fnal.fnal.gov
  10. NNTP-Posting-Host: fsgi01.fnal.gov
  11. X-Newsreader: NN version 6.5.0 #9 (NOV)
  12.  
  13. normanb@halcyon.com (Norm Bryar) writes:
  14.  
  15. ...
  16. >    Lastly, in MSVC4, I erroneously tried getting from B1 to B2 without an
  17. >intermediate dynamic_cast to D in the following hierarchy:  
  18.  
  19. >        class D : public B1, public B2.  
  20.  
  21. >It threw an access violation and then a "MS C++ Exception."  I thought
  22. >it was just supposed to return NULL if it couldn't make the cast.
  23.  
  24. I assume you mean that you tried to cast a B1* to a B2*, where the
  25. object pointed to is actually a D, and B1 has at least one virtual
  26. function.
  27.  
  28. In that case, you have encountered a compilaer limitation or bug. BCC
  29. handles such a dynamic cast properly. Such a dynamic cast is in accordance
  30. with the draft C++ standard.
  31. -- 
  32. ***** Listen Americans, the IRS is your taxer,  the IRS is one. *****
  33. David Sachs - Fermilab, HPPC MS369 - P. O. Box 500 - Batavia, IL 60510
  34. Voice: 1 708 840 3942      Deparment Fax: 1 708 840 3785
  35.